<!--
 * @FilePath     : /study_code/layui/6-3-16.html
 * @Description  : .iframeSrc(index, url) / 重置特定 iframe url
 * @Date         : 2025-04-08 17:33:58
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-04-09 09:16:34
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="/layui/dist/css/layui.css" />
  </head>
  <body>
    <div style="position: fixed; z-index: 999999999999999999;">
      <button id="btn">打开1个 iframe 层</button>
      <button id="btn1">重新设置 iframe 层 url</button>
    </div>
    <hr />
    <script src="/layui/dist/layui.js"></script>
    <script>
      layui.use(['layer'], function () {
        var layer = layui.layer

        var theIndex = null
        // 先打开 iframe 层
        btn.addEventListener('click', function () {
          theIndex = layer.open({
            type: 2,
            content: '/layui/layer/6316/ifr1.html',
            area: ['600px', '400px'],
          })
        })

        // 重新设定
        btn1.addEventListener('click', function () {
          layer.iframeSrc(theIndex, '/layui/layer/6316/ifr2.html')
        })
      })
    </script>
  </body>
</html>
